﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Students.aspx.cs" Inherits="Students" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 1315px;
            height: 311px;
            position: absolute;
            top: 15px;
            left: 10px;
        }
        .style2
        {
            width: 125px;
            height: 67px;
            position: absolute;
            top: 131px;
            left: 353px;
            z-index: 1;
        }
        .style3
        {
            position: absolute;
            top: 80px;
            left: 775px;
            z-index: 1;
            bottom: 209px;
        }
        .style4
        {
            width: 187px;
            height: 133px;
            position: absolute;
            top: 119px;
            left: 733px;
            z-index: 1;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server" class="style1" style="z-index: 1">
    <div>
    
        <h2>Student Records&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Student Details&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            Drop Down List SQL Data Source</h2>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EC AssignmentConnectionString %>" 
        SelectCommand="SELECT [Student_ID], [First_Name], [Last_Name] FROM [Students]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:EC AssignmentConnectionString %>" 
        DeleteCommand="DELETE FROM [Students] WHERE [Student_ID] = @original_Student_ID AND [First_Name] = @original_First_Name AND [Last_Name] = @original_Last_Name AND [GPA] = @original_GPA AND [Email] = @original_Email" 
        InsertCommand="INSERT INTO [Students] ([Student_ID], [First_Name], [Last_Name], [GPA], [Email]) VALUES (@Student_ID, @First_Name, @Last_Name, @GPA, @Email)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [Students] WHERE ([Student_ID] = @Student_ID)" 
        UpdateCommand="UPDATE [Students] SET [First_Name] = @First_Name, [Last_Name] = @Last_Name, [GPA] = @GPA, [Email] = @Email WHERE [Student_ID] = @original_Student_ID AND [First_Name] = @original_First_Name AND [Last_Name] = @original_Last_Name AND [GPA] = @original_GPA AND [Email] = @original_Email">
        <DeleteParameters>
            <asp:Parameter Name="original_Student_ID" Type="Int32" />
            <asp:Parameter Name="original_First_Name" Type="String" />
            <asp:Parameter Name="original_Last_Name" Type="String" />
            <asp:Parameter Name="original_GPA" Type="Double" />
            <asp:Parameter Name="original_Email" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Student_ID" Type="Int32" />
            <asp:Parameter Name="First_Name" Type="String" />
            <asp:Parameter Name="Last_Name" Type="String" />
            <asp:Parameter Name="GPA" Type="Double" />
            <asp:Parameter Name="Email" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="Student_ID" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="First_Name" Type="String" />
            <asp:Parameter Name="Last_Name" Type="String" />
            <asp:Parameter Name="GPA" Type="Double" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="original_Student_ID" Type="Int32" />
            <asp:Parameter Name="original_First_Name" Type="String" />
            <asp:Parameter Name="original_Last_Name" Type="String" />
            <asp:Parameter Name="original_GPA" Type="Double" />
            <asp:Parameter Name="original_Email" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:DropDownList ID="DropDownList1" runat="server" CssClass="style3" 
        DataSourceID="SqlDataSource3" DataTextField="Faculty_ID" 
        DataValueField="Faculty_ID" 
        onselectedindexchanged="DropDownList1_SelectedIndexChanged">
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EC AssignmentConnectionString %>" 
        SelectCommand="SELECT [Faculty_ID] FROM [Faculty]"></asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
        AutoGenerateColumns="False" DataKeyNames="Student_ID" 
        DataSourceID="SqlDataSource1" BackColor="#CCCCCC" BorderColor="#999999" 
        BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" 
        ForeColor="Black">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="Student_ID" HeaderText="Student_ID" ReadOnly="True" 
                SortExpression="Student_ID" />
            <asp:BoundField DataField="First_Name" HeaderText="First_Name" 
                SortExpression="First_Name" />
            <asp:BoundField DataField="Last_Name" HeaderText="Last_Name" 
                SortExpression="Last_Name" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
        <RowStyle BackColor="White" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#808080" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#383838" />
    </asp:GridView>
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        CssClass="style2" DataKeyNames="Student_ID" DataSourceID="SqlDataSource2" 
        Height="50px" Width="125px" BackColor="#CCCCCC" BorderColor="#999999" 
        BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" 
        ForeColor="Black">
        <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <Fields>
            <asp:BoundField DataField="Student_ID" HeaderText="Student_ID" ReadOnly="True" 
                SortExpression="Student_ID" />
            <asp:BoundField DataField="First_Name" HeaderText="First_Name" 
                SortExpression="First_Name" />
            <asp:BoundField DataField="Last_Name" HeaderText="Last_Name" 
                SortExpression="Last_Name" />
            <asp:BoundField DataField="GPA" HeaderText="GPA" SortExpression="GPA" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        </Fields>
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
        <RowStyle BackColor="White" />
    </asp:DetailsView>
    <asp:Button ID="FormBtn" runat="server" onclick="FormBtn_Click" 
        Text="Form View" />
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" 
        CellPadding="4" CellSpacing="2" CssClass="style4" DataSourceID="SqlDataSource4" 
        ForeColor="Black">
        <Columns>
            <asp:BoundField DataField="Faculty_Name" HeaderText="Faculty_Name" 
                SortExpression="Faculty_Name" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
        <RowStyle BackColor="White" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#808080" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#383838" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EC AssignmentConnectionString %>" 
        SelectCommand="SELECT [Faculty_Name] FROM [Faculty] WHERE ([Faculty_ID] = @Faculty_ID)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="Faculty_ID" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
